package builderPatten1;

import cn.hutool.json.JSONUtil;

/**
 * @Author: 582895699@qq.com
 * @Desctription: 传统建造者模式
 * @Date: Created in 2021/12/14 10:43
 */
public class ComputerDirector {

    public void makeComputer(ComputerBuilder builder) {
        builder.setUsbCount();
        builder.setKeyboard();
        builder.setDisplay();
    }

    public static void main(String[] args) {
        ComputerDirector computerDirector = new ComputerDirector();
        MacComputerBuilder macComputerBuilder = new MacComputerBuilder("mac-cpu", "mac-ram");
        computerDirector.makeComputer(macComputerBuilder);
        Computer computer = macComputerBuilder.getComputer();
        System.out.println(JSONUtil.toJsonStr(computer));

    }
}
